#version 130

vec2 rectCoord[4];

uniform uint character;
uniform vec4 u_Color; //The color attribute which was passed in from the program
out vec4 color; //The output color which will be passed to the fragment shader
out vec2 texcoord0;

void main(void)
{
	rectCoord[0]=vec2(0.0f,0.0f);
	rectCoord[1]=vec2(1.0f,0.0f);
	rectCoord[2]=vec2(1.0f,1.0f);
	rectCoord[3]=vec2(0.0f,1.0f);

	vec2 newcoord = vec2(rectCoord[gl_VertexID].x,1.0-rectCoord[gl_VertexID].y);
	newcoord.x += mod(float(character),16.0);
	newcoord.y += floor(float(character)/16.0)+0.1;
	newcoord /= 16.0;

	gl_Position = gl_ModelViewProjectionMatrix * vec4(rectCoord[gl_VertexID],0.0, 1.0);
	color = vec4(1.0);
	texcoord0 = vec2(newcoord.x,newcoord.y);
}